#ifndef _VIDEOPALYER_H_
#define _VIDEOPALYER_H_

#include "def.h"
#include "mjpeg.h"
#include "avi.h"
#include "porting.h"
#include "ff.h"
#include "draw.h"

#ifdef __cplusplus
extern "C"{
#endif

typedef enum {
	VIDEO_PLAYER_OVER = 1,
}VIDEO_STA;

typedef void(*VIDEO_PLAYER_CALLBACK)(VIDEO_STA sta);

typedef struct{
	VIDEO_PLAYER_CALLBACK over_func;
	FIL favi;
	u8 streambuf[AVI_VIDEO_BUF_SIZE];
	AVI_INFO avix;
	void * hpcm;
	struct jpeg_decompress_struct *cinfo;
	struct my_error_mgr *jerr;
	u8 *jpegbuf;			
	u16 *outrectbuf;		
	u16 outlinecnt;			
	u32 jbufsize;			
	u16 imgoffx;
    u16 imgoffy;	
	u8 *jmembuf;			
	u32 jmempos;
	uint8_t volume;
	void *volume_obj;
	OAL_THREAD thread;
	OAL_SEM exit;	
    volatile int pause;	
}AVI_PLAYER;

extern AVI_PLAYER *g_video_player;

int8_t video_play_avi(u8 *pname, VIDEO_PLAYER_CALLBACK over_func);
int8_t video_stop_avi();
int8_t video_pause_avi();
int8_t video_resume_avi();
int8_t video_set_volume(uint8_t volume);

#ifdef __cplusplus
}
#endif

#endif
